]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Unset the results for the current provider if the new search failed
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 17 Feb 2026 14:02:56 +0000 (15:02 +0100)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 17 Feb 2026 14:02:56 +0000 (15:02 +0100)
In case the provider search or subsearch failed, the old results are
preserved, while they should be reset or we may show invalid data

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4080>

js/ui/search.js

index 76e49bc1e2a1ebf0fea179062814325c55549b38..b96ec635c7de0189044df8e5a231aefeae8b65f7 100644 (file)
@@ -692,20 +692,22 @@ export const SearchResultsView = GObject.registerClass({
     async _doProviderSearch(provider, previousResults) {
         provider.searchInProgress = true;
 
-        let results;
-        if (this._isSubSearch && previousResults) {
-            results = await provider.getSubsearchResultSet(
-                previousResults,
-                this._terms,
-                this._cancellable);
-        } else {
-            results = await provider.getInitialResultSet(
-                this._terms,
-                this._cancellable);
+        let results = [];
+        try {
+            if (this._isSubSearch && previousResults) {
+                results = await provider.getSubsearchResultSet(
+                    previousResults,
+                    this._terms,
+                    this._cancellable);
+            } else {
+                results = await provider.getInitialResultSet(
+                    this._terms,
+                    this._cancellable);
+            }
+        } finally {
+            this._results[provider.id] = results;
+            await this._updateResults(provider, results);
         }
-
-        this._results[provider.id] = results;
-        await this._updateResults(provider, results);
     }
 
     _doSearch() {